<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see SiteController
 */
class SiteController extends BaseController
{

    /**
     * phoneLogin
     * @uri /site/phone-login
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"phone":"D8F3E623A91D70DC","code":"3D6512A77BF0BC26"}
     * @response {"success":true,"statusCode":200,"result":{"id":"00K5H1KO60NAEIXXDT1SPMMM","phone":"157****7560","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png","status":1,"special_signature":"\u6211\u662f\u4e00\u4e2a\u7c89\u5237\u5320~","birthday":960336000,"gender":1,"description":"","province":0,"city":0,"industry":0,"job":1,"education":7,"created_at":1579197762,"login_method":1,"server_time":1606627751},"message":"OK"}
     */
    public function phoneLogin(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"id":"00K5H1KO60NAEIXXDT1SPMMM","phone":"157****7560","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png","status":1,"special_signature":"\u6211\u662f\u4e00\u4e2a\u7c89\u5237\u5320~","birthday":960336000,"gender":1,"description":"","province":0,"city":0,"industry":0,"job":1,"education":7,"created_at":1579197762,"login_method":1,"server_time":1606627751},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * pwdLogin
     * @uri /site/pwd-login
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"phone":"70EDF71FD18DEC92","password":"671C584C218C0806"}
     * @response {"success":true,"statusCode":200,"result":{"id":"00K5H1KO60NAEIXXDT1SPMMM","phone":"157****7560","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png","status":1,"special_signature":"\u6211\u662f\u4e00\u4e2a\u7c89\u5237\u5320~","birthday":960336000,"gender":1,"description":"","province":0,"city":0,"industry":0,"job":1,"education":7,"created_at":1579197762,"login_method":1,"server_time":1606627751},"message":"OK"}
     */
    public function pwdLogin(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"id":"00K5H1KO60NAEIXXDT1SPMMM","phone":"157****7560","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png","status":1,"special_signature":"\u6211\u662f\u4e00\u4e2a\u7c89\u5237\u5320~","birthday":960336000,"gender":1,"description":"","province":0,"city":0,"industry":0,"job":1,"education":7,"created_at":1579197762,"login_method":1,"server_time":1606627751},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}